package com.hcw.bankdemob.controller;

/**
 * @ClassName OutTradeServiceController
 * @description: 提供给外部系统调用的服务
 * @author: hcw
 * @time: 2020/8/31 21:53
 */

import com.hcw.bankdemob.service.DBbAccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController()
@RequestMapping("/outTradeServiceB")
@Slf4j
public class OutTradeServiceController {
    @Autowired
    DBbAccountService dBbAccountServiceImpl;

    /**
     * @description: 转账业务
     * @param  aId:调用方的唯一标示
     * @return: boolean
     * @author: hcw
     * @time: 2020/8/31 19:36
     */
    @GetMapping("/transferMoney")
    public boolean transferMoney(@RequestParam("fromName")String  fromName, @RequestParam("toName")String  toName, @RequestParam("money")BigDecimal money,@RequestParam("aId")int aId) {
        log.debug("收到参数："+fromName+"~~~~~~~"+toName+"~~~~~~"+money.toString()+"~~~~~~~"+aId);
        return dBbAccountServiceImpl.toAccoutTransfer(fromName, toName, money,aId);
    }

}